/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.tspp.dao.dto;

import java.io.Serializable;

/**
 * Transfer object for Application table(DAO pattern)
 * @author Maks
 */
public class Application implements Serializable {

    /** This attribute maps to the column ID_ENTRANT in the APPLICATION table.*/
    private int idEntrant;

    /** This attribute maps to the column ID_SPECIALITY in the APPLICATION table.*/
    private int idSpeciality;

    /** This attribute maps to the column ACCEPTED in the APPLICATION table.*/
    private boolean accepted;

    /**
     * Return value of the column ID_ENTRANT in the APPLICATION table
     * @return int id of entrant of current application
     */
    public int getIdEntrant() {
        return idEntrant;
    }

    /**
     * Set the id of entrant
     * @param idEntrant
     */
    public void setIdEntrant(int idEntrant) {
        this.idEntrant = idEntrant;
    }

    /**
     * Return value of the column ID_SPECIALITY in the APPLICATION table.
     * @return int id of speciality of current application
     */
    public int getIdSpeciality() {
        return idSpeciality;
    }

    /**
     * Method 'setIdSpeciality'
     *
     * @param idSpeciality
     */
    public void setIdSpeciality(int idSpeciality) {
        this.idSpeciality = idSpeciality;
    }

    /**
     * Check if the entrant was accepted to the university
     * @return boolean true if was accepted
     */
    public boolean isAccepted() {
        return accepted;
    }

    /**
     * Set the state of acceptence
     * @param accepted
     */
    public void setAccepted(boolean accepted) {
        this.accepted = accepted;
    }


    /**
     * Method 'equals'
     *
     * @param _other
     * @return boolean
     */
    @Override
    public boolean equals(Object _other) {
        if (_other == null) {
            return false;
        }

        if (_other == this) {
            return true;
        }

        if (!(_other instanceof Application)) {
            return false;
        }

        final Application _cast = (Application) _other;
        if (idEntrant != _cast.idEntrant) {
            return false;
        }

        if (idSpeciality != _cast.idSpeciality) {
            return false;
        }

        if (accepted != _cast.accepted) {
            return false;
        }
        return true;
    }

    /**
     * Method 'hashCode'
     *
     * @return int
     */
    @Override
    public int hashCode() {
        int _hashCode = 0;
        _hashCode = 29 * _hashCode + idEntrant;
        _hashCode = 29 * _hashCode + idSpeciality;
        _hashCode = 29 * _hashCode + (accepted ? 1 : 0);
        return _hashCode;
    }

    /**
     * Method 'toString'
     *
     * @return String
     */
    @Override
    public String toString() {
        StringBuilder ret = new StringBuilder();
        ret.append("com.tspp.dao.dto.Application: ");
        ret.append("idEntrant=").append(idEntrant);
        ret.append(", idSpeciality=").append(idSpeciality);
        ret.append(", accepted=").append(accepted);
        return ret.toString();
    }
}
